; -*- mode: lisp; -*-

(RSG 0 1)
(
 ; create the torso
 (nd AgentAspect
       (setName torso)
       (setLocalPos 0 0 0.5)
       (importScene rsg/boxspheres/box.rsg 1.3 1 0.5 5 matRed)

       ; install a perceptor to receive the current simulation time
       (nd TimePerceptor)

       ; install a node holding agent state data
       (nd AgentState
	     (setName AgentState)
	     )

       ; install a perceptor to receive info about ball and player positions
       (nd VisionPerceptor
	     (setSenseMyPos false)
	     (setStaticSenseAxis false)
	     (addNoise false)
	     )

       ; install a kick effector
       (nd KickEffector
	     (setKickMargin 2)
	     (setForceFactor 0.7)
	     (setTorqueFactor 0.1)
	     (setNoiseParams 0.4 0.02 0.9 4.5)
	     (setSteps 10)
	     (setMaxPower 100.0)
	     (setAngleRange 0.0 50.0)
	     )

       ; install a beam effector
       (nd BeamEffector)

       (nd Transform
	     (setLocalPos 0 1.5 0)
	     (nd Box
		   (setMaterial matGrey)
		   (setExtents 1 0.1 0.2)
		   )
	     )

       (nd Transform
	     (setLocalPos 0 1.1 0)
	     (nd Box
		   (setMaterial matGrey)
		   (setExtents 0.1 0.8 0.2)
		   )
	     )
       )

 ; install the left tire
 (nd Transform
       (setName leftTire)
       (setLocalPos -0.6 0.5 0.5)
       (importScene rsg/boxspheres/sphere.rsg 0.51 2 matWhite)
       (nd Transform
	     (setLocalRotation 0 0 180)

	     ; install the joint
	     (nd Hinge2Joint
		   (attach ../../sphereBody ../../../torso/boxBody)
		   (setAnchor 0 0 0)

		   ; enable the joint motor
		   (setMaxMotorForce 1 4000)

		   ; install a perceptor to measure the tire movement
		   (nd Hinge2Perceptor
			 (setName ltp)
			 )

		   ; install an effector to control the joint motor
		   (nd Hinge2Effector
			 (setName lte)
			 )
		   )

	     ; add some boxes to visualize the tire spin
	     (nd Box
		   (setExtents 1.1 0.1 0.1)
		   (setMaterial matBlue)
		   )

	     (nd Box
		   (setExtents 0.1 1.1 0.1)
		   (setMaterial matRed)
		   )

	     (nd Box
		   (setExtents 0.1 0.1 1.1)
		   (setMaterial matYellow)
		   )	     
	     )
       )

 ; install the right tire
 (nd Transform
       (setName rightTire)
       (setLocalPos 0.6 0.5 0.5)
       (importScene rsg/boxspheres/sphere.rsg 0.51 2 matWhite)
       (nd Transform
	     (setLocalRotation 0 0 180)

	     ; install the joint
	     (nd Hinge2Joint
		   (attach ../../sphereBody ../../../torso/boxBody)
		   (setAnchor 0 0 0)

		   ; enable the joint motor
		   (setMaxMotorForce 1 4000)

		   ; install a perceptor to measure the tire movement
		   (nd Hinge2Perceptor
			 (setName rtp)
			 )

		   ; install an effector to control the joint motor
		   (nd Hinge2Effector
			 (setName rte)
			 )
		   )

	     ; add some boxes to visualize the tire spin
	     (nd Box
		   (setExtents 1.1 0.1 0.1)
		   (setMaterial matBlue)
		   )

	     (nd Box
		   (setExtents 0.1 1.1 0.1)
		   (setMaterial matRed)
		   )

	     (nd Box
		   (setExtents 0.1 0.1 1.1)
		   (setMaterial matYellow)
		   )

	     )
       )

 ; install passive back tire
 (nd Transform
       (setName backTire)
       (setLocalPos 0 -0.55 0.5)
       (importScene rsg/boxspheres/sphere.rsg 0.51 2 matGrey)
	; install the joint
       (nd Hinge2Joint
	     (attach ../sphereBody ../../torso/boxBody)
	     (setAnchor 0 0 0)
	     )
       ) 
)
